﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UFIDA.U9.Cust.XH.PlugBE.Model
{
    /// <summary>
    /// 客户
    /// </summary>
    public class CustomerModel
    {
        public CustomerModel(UFIDA.U9.CBO.SCM.Customer.Customer m)
        {
            this.CustomerCategory_Name = m.CustomerCategory?.Name;
            this.Code = m.Code;
            this.Name = m.Name;
            this.ShortName = m.ShortName;
            this.CreatedBy = m.CreatedBy;
            this.CreatedOn = m.CreatedOn;
            this.Saleser_Name = m.Saleser?.Name;
            this.ARConfirmTerm_Name = m.ARConfirmTerm?.Name;
            this.IsUseAppPotal = m.IsUseAppPotal;            
            this.State = CBO.SCM.Customer.CustomerStatesEnum.EnumRes.GetResource(m.State.Name);
            this.Effective_IsEffective = m.Effective.IsEffective;
            this.Effective_DisableDate = m.Effective.DisableDate;
            this.Effective_EffectiveDate = m.Effective.EffectiveDate;
            this.TaxSchedule_Name = m.TaxSchedule?.Name;
            this.DefaultContact_Name = m.DefaultContact?.Name;
            this.TradeCurrency_Name = m.TradeCurrency?.Name;
            this.StateTaxNo = m.StateTaxNo;
            foreach (CBO.SCM.Customer.CustomerBankAccount item in m.CustomerBankAccount)
            {
                BankName = item.Name;
                BankCode = item.Code;
                BankOpenAccountName = item.Bank.UOpenAccount.Name;
                break;
            }


        }
        public string CustomerCategory_Name { get; set; }
        public string Code { get; set; }
        public string Name { get; set; }
        public string ShortName { get; set; }
        public string CreatedBy { get; set; }
        public DateTime CreatedOn { get; set; }
        public string Saleser_Name { get; set; }
        public string ARConfirmTerm_Name { get; set; }
        public bool IsUseAppPotal { get; set; }
        public string State { get; set; }



        public bool Effective_IsEffective { get; set; }
        public DateTime Effective_DisableDate { get; set; }
        public DateTime Effective_EffectiveDate { get; set; }


        public string TaxSchedule_Name { get; set; }
        public string DefaultContact_Name { get; set; }
        public string TradeCurrency_Name { get; set; }
        public string BankOpenAccountName { get; set; }
        public string BankCode { get; set; }
        public string BankName { get; set; }
        /// <summary>
        /// 纳税人识别号
        /// </summary>
        public string StateTaxNo { get; set; }

    }
}
